{template 'header'}
<ul class="nav nav-tabs">
	<li {if $op == 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('listvolist', array('op' => 'post'));}">添加</a></li>
  <li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('listvolist', array('op' => 'display'));}">列表</a></li>
</ul>

{if $op == 'post'}
<div class="main">

<form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
		<div class="panel panel-default">
			<div class="panel-heading">
				新增数据
			</div>
			<div class="panel-body">
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span style="color:red">*</span>昵称</label>
					<div class="col-sm-9 col-xs-12">
						<input type="text" name="username" class="form-control" value="" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">头像</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_form_field_image('avatar', $item['avatar'])}
					</div>
				</div>
			</div>
		</div>
		<div class="form-group col-sm-12">
			<input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
			<input type="hidden" name="token" value="{$_W['token']}" />
		</div>
</form>
</div>
{elseif $op == 'display'}
<div class="main">

<div class="panel panel-info">
	<div class="panel-heading"><a class="btn btn-sm btn-danger" href="{php echo $this->createWebUrl('autovolist')}"><i class="fa fa-mail-forward"></i> 初始数据</a>
</div>
</div>

<form method="post" class="form-horizontal" id="form1">
  <div class="panel panel-default" style="padding:0px 15px 0 15px">
  <div class="panel-body table-responsive">
    <table class="table table-hover"  style="width:100%;z-index:-10;" cellspacing="0" cellpadding="0">
      <thead class="navbar-inner">
        <tr>
          <th style="width:10%;">多选</th>
          <th style="width:20%;">头像</th>
          <th style="width:50%;">昵称</th>
          <th style="text-align:right; min-width:120px;width:20%;">操作</th>
        </tr>
      </thead>
      <tbody>
        {loop $list $item}
        <tr>
          <td><input type="checkbox" name="id[]" value="{$item['id']}" class=""></td>
          <td><img src="{if !empty($item['avatar'])}{php echo tomedia($item['avatar']);}{else}resource/images/noavatar_middle.gif{/if}" width="48"></td>
          <td>{$item['username']}</td>
          <td style="text-align:right;">
            <a href="{php echo $this->createWebUrl('listvolist', array('id' => $item['id'], 'op' => 'delete'))}" onclick="return confirm('此操作不可恢复，确认删除？');return false;" title="删除" class="btn btn-sm"><i class="fa fa-remove"></i></a>
          </td>
        </tr>
        {/loop}
      </tbody>
      <tfoot>
        <tr>
          <td colspan="2">共计{$total}条</td>
          <td colspan="2">{$pager}</td>
        </tr>
      </tfoot>
    </table>
  </div>
  </div>
</form>
</div>
{/if}
{template 'footer'}                    